/*
 * @Description:
 * @Author: xuzp4
 * @Date: 2022-03-22 09:06:08
 * @LastEditors: xuzp4
 * @LastEditTime: 2022-04-06 11:44:40
 * @FilePath: \visitor_management\src\router\index.js
 */
import Vue from "vue";
import Router from "vue-router";
import Layout from "../Layout/index";
import Login from "../views/login/index.vue";
import Renlianbidui from "../views/renlianbidui/index.vue";
import Zhuapaijilu from "../views/zhuapaijilu/index.vue";
import WarnSearch from "@/views/warnSearch/index.vue";
import Renxiangku from "@/views/renxiangkuguanli/index.vue";
import Yonghuguanli from "@/views/yonghuguanli/index.vue";
import Video from "@/views/video";
import Report from "@/views/report";
import Moshengrenjulei from "@/views/moshengrenjulei/index.vue";
import Changguishezhi from '@/views/general'
import Wangluoshezhi from '@/views/wangluoshezhi'
import GreyList from '@/views/greyList'
import Targets from '@/views/targets'
import Renlianjiance from '@/views/renlianjiance'
import Renyuandangan from '@/views/renyuandangan'
import RecordTargets from '@/views/recordTargets'
import GreyRecord from '@/views/greyRecord'
import Storage from '@/views/storage'
import Logs from '@/views/logs'
import System from '@/views/system'
import DataPush from '@/views/dataPush'
import Equipment from '@/views/equipment'
import VehicleInfo from '@/views/vehicleInfo'
import VehicleTable from '@/views/vehicleTable'
// import Test from '@/views/draw';
Vue.use(Router);
import shishiyulanIcon from "@/assets/shishiyulan.png";
import shebeiguanli_icon from "@/assets/shebeiguanli_icon.png";
import xitongguanli_icon from "@/assets/xitongguanli_icon.png";
import xitongshezhi_icon from "@/assets/xitongshezhi_icon.png";
// const allowList = ['home']
export const constantRoutes = [{
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: '/404',
    component: resolve => require(['@/views/404'], resolve),
    hidden: true
  },
  // { // 测试用11111111111111111
  //   path: "/test",
  //   name: 'test',
  //   component: Video,
  //   hidden: true,
  //   meta: {
  //     title: "test",
  //   },
  // },
];
export const asyncRoutes = [{
    path: '/video',
    component: Layout,
    children: [{
      path: '',
      name: 'video',
      component: Video,
      meta: {
        title: 'shishiyulan',
        icon: shishiyulanIcon,
        authIndex: 0
      }
    }]
  },
  {
    path: '/report',
    component: Layout,
    children: [{
      path: '',
      name: 'report',
      component: Report,
      meta: {
        title: 'dapingtongji',
        icon: xitongshezhi_icon,
        authIndex: 0
      }
    }]
  },
  {
    path: "/jiluchaxun",
    component: Layout,
    redirect: "/jiluchaxun/snapSearch",
    meta: {
      title: "jiluchaxun",
    },
    children: [{
        path: "snapSearch",
        component: Zhuapaijilu,
        meta: {
          title: "zhuapaijilu",
          authIndex: 1
        },
      },
      {
        path: "warnSearch",
        component: WarnSearch,
        meta: {
          title: "gaojingjiluchaxun",
          authIndex: 2
        },
      },
    ],
  },
  {
    path: "/zhinengyewu",
    component: Layout,
    redirect: "/zhinengyewu/library",
    meta: {
      title: "zhinengyewu",
    },
    children: [{
        path: "greyList",
        component: GreyList,
        name: 'greyList',
        hidden: true,
        meta: {
          title: "moshengrenku",
          authIndex: 16
        },
      },
      {
        path: "targets",
        name: 'targets',
        component: Targets,
        hidden: true,
        meta: {
          title: "targets",
        },
      },
      {
        path: "library",
        component: Renxiangku,
        name: 'library',
        meta: {
          title: "renxiangkuguanli",
          authIndex: 3
        },
      },
      {
        path: "libraryRecord",
        component: Renyuandangan,
        name: 'libraryRecord',
        meta: {
          title: "renyuandangan",
          authIndex: 17
        },
      },
      {
        path: "moshengrenjulei",
        component: Moshengrenjulei,
        meta: {
          title: "moshengrenjulei",
          authIndex: 18
        },
      },
      {
        path: "vehicleInfo",
        component: VehicleInfo,
        meta: {
          title: "cheliangguanli",
          authIndex: 19
        },
      },
      {
        path: "vehicleTable",
        name: 'vehicleTable',
        component: VehicleTable,
        hidden:true,
        meta: {
          title: "vehicleTable",
        },
      },
      {
        path: "recordTargets",
        name: 'recordTargets',
        component: RecordTargets,
        hidden: true,
        meta: {
          title: "recordTargets",
        },
      },
      {
        path: "greyRecord",
        name: 'greyRecord',
        component: GreyRecord,
        hidden: true,
        meta: {
          title: "danganxiangqing",
          authIndex: 20
        },
      },
      {
        path: "faceDetection",
        component: Renlianjiance,
        meta: {
          title: "renlianjiance",
          authIndex: 4
        },
      },
      {
        path: "faceCompare",
        component: Renlianbidui,
        meta: {
          title: "renlianbidui",
          authIndex: 5
        },
      },
    ],
  },
  {
    path: "/equipment",
    component: Layout,
    meta: {
      title: "shebeiguanli",
      icon: shebeiguanli_icon,
    },
    children: [{
      path: "",
      component: Equipment,
      meta: {
        title: "shebeiguanli",
        authIndex: 6
      },
    }]
  },
  {
    path: "/systemManagement",
    component: Layout,
    redirect: "/systemManagement/user",
    meta: {
      title: "xitongguanli",
      icon: xitongguanli_icon,
    },
    children: [{
        path: "user",
        component: Yonghuguanli,
        meta: {
          title: "yonghuguanli",
          authIndex: 8
        },
      },
      {
        path: "storage",
        component: Storage,
        meta: {
          title: "cunchuguanli",
          authIndex: 9
        },
      },
      {
        path: "logs",
        component: Logs,
        meta: {
          title: "rizhiguanli",
          authIndex: 11
        },
      },
    ],
  },
  {
    path: "/systemConfig",
    component: Layout,
    redirect: "/systemConfig/general",
    meta: {
      title: "xitongshezhi",
      icon: xitongshezhi_icon,
    },
    children: [{
        path: "general",
        component: Changguishezhi,
        meta: {
          title: "changguishezhi",
          authIndex: 12
        },
      },
      {
        path: "network",
        component: Wangluoshezhi,
        meta: {
          title: "wangluoshezhi",
          authIndex: 13
        },
      },
      {
        path: "system",
        component: System,
        meta: {
          title: "xitongxinxi",
          authIndex: 14
        },
      },
      {
        path: "dataPush",
        component: DataPush,
        meta: {
          title: "shujutuisong",
          authIndex: 21
        },
      },
    ],
  },
  {
    path: "/",
    redirect: "/video",
  },
];
const createRouter = () =>
  new Router({
    scrollBehavior: () => ({
      y: 0,
    }),
    routes: constantRoutes,
  });

const router = createRouter();
// console.log('router',router.getRoutes())
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher;
}
export default router;